// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

LL bin(LL a, LL b, LL p) {
	LL res = 1;
	for (a%=p; b; b>>=1, a=a*a%p)
		if (b & 1)
			res = res * a % p;
	return res;
}

int n, m;
typedef long double LD;
const int N = 1e5+50;

LD dp(int x, int y) {
	int cnt = x+y;
	int p1 = x, p2 = y;
	LD ans = 1;
	for (int i=1; i<=x+y; ++i) {
		ans *= i;
		while (ans > 1 && cnt) {
			ans /= 2;
			--cnt;
		}
		while (ans > 1 && p1) {
			ans /= p1--;
		}
		while (ans > 1 && p2) {
			ans /= p2--;
		}
	}
	while (cnt) {
		ans /= 2;
		--cnt;
	}
	while (p1) {
		ans /= p1--;
	}
	while (p2) {
		ans /= p2--;
	}
	dbg(x, y, ans);
	return ans;

}

int main(int argc, char const *argv[]) {
    int t;
    scanf("%d", &t);
    for (int kk=0; kk<t; ++kk) {
    	printf("Case #%d: ", kk+1);
    	pair<int, int> p1, p2;
    	scanf("%d%d%d%d%d%d", &m, &n, &p1.first, &p1.second, &p2.first, &p2.second);
    	--p1.first;
    	--p1.second;
    	--p2.first;
    	--p2.second;
    	swap(p1.first, p1.second);
    	swap(p2.first, p2.second);
    	if (p2.second == m-1)
    		p1.first = 0;
    	if (p2.first == n-1)
    		p1.second = 0;
    	dbg(p1.first, p1.second, p2.first, p2.second);
    	if (p1.first + p1.second == 0) {
    		printf("0.000000\n");
    		continue;
    	}
    	LD ans = 0;
    	if (p1.second > 0) {
    		LD del = dp(p1.first, p1.second-1);
    		for (int i=p1.first; i<=p2.first; ++i) {
    			LD c = i+1<n? 0.5 : 1;
    			ans += del * c;
    			dbg(del);
    			del = del * (i+p1.second) / 2 / (i+1);
    		}
    	}

    	if (p1.first > 0) {
    		LD del = dp(p1.first-1, p1.second);
    		for (int i=p1.second; i<=p2.second; ++i) {
    			LD c = i+1<m? 0.5 : 1;
    			ans += del * c;
    			dbg(del);
    			del = del * (i+p1.first) / 2 / (i+1);
    		}
    	}
    	printf("%.6Lf\n", 1-ans);
    }
    return 0;
}